import React, { Component } from "react";

class Details extends Component {
  constructor(props) {
    super(props);
    this.state = {
      user: "",
    };
  }
  componentDidMount() {
    console.log(this.props.location);
    if (this.props.location.state) {
      this.setState({
        user: this.state.user,
      });
      console.log(this.state.user);
    }
  }
  render() {
    return (
      <div className="miui_content">
        <div className="head">
          <div className="head_list">
            <ul className="head_nav">
              <li>小米商城</li>
              <li>MIUI</li>
              <li>loT</li>
              <li>云服务</li>
              <li>天星数科</li>
              <li>有品</li>
              <li>小爱开放平台</li>
              <li>企业团购</li>
              <li>资质证照</li>
              <li>协议规则</li>
              <li>下载App</li>
              <li>智能生活</li>
              <li>Select Location</li>
            </ul>
            <ul className="head_login">
              <li>
                <i
                  onClick={() => {
                    console.log(this.props);
                    this.props.history.push("/login");
                  }}
                >
                  登录
                </i>
              </li>
              <li>注册</li>
              <li>消息通知</li>
              <li>用户：{this.state.user}</li>
            </ul>
          </div>
        </div>
     <div>的萨达按时的买的</div>
      </div>
    );
  }
}

export default Details;
